<template>
	<view class="page" :style="{minHeight:$height()}">
		<view class="header centerFlex">
			<view class="item sideFlex" @click="$next(`/pages/index/feedback`)">
				<image src="@/static/Icon/edit.png" class="image"></image>
				<view class="txt">
					反馈意见
				</view>
			</view>
			<view class="verticalLine"></view>
			<view class="item sideFlex" @click="tel">
				<image src="@/static/Icon/tel.png" class="image"></image>
				<view class="txt">
					资讯电话
				</view>
			</view>
		</view>
		<!-- 底部附加信息 -->
		<ul class="footer">
			<li class="rewoundFlex">
				<view class="liTitle startFlex">
					<view class="lit1">
						常见问题解答
					</view>
					<view class="lit11">
						匠心打造完整服务体系
					</view>
				</view>
				<u-icon name="arrow-right" style="margin-left: 10rpx; font-size: 32rpx; color: #FFFFFF;"></u-icon>
			</li>
			<li class="rewoundFlex" v-for="(item,index) in list" :index="index"
				@click="$next(`/pages/index/problemDetail?id=${item.id}`)">
				<view class="liTitle startFlex">
					<view :class="problemClass[item.type].className">
						{{problemClass[item.type].name}}
					</view>
					<view class="lit2">
						{{item.title}}
					</view>
				</view>
				<u-icon name="arrow-right" style="margin-left: 10rpx; font-size: 32rpx; color: #BBBBBB ;"></u-icon>
			</li>

		</ul>
		<u-loadmore v-if="list.length !== 0" :status="status" :load-text="loadText" />
		<image v-else src="@/static/image/empty.png" mode="widthFix" class="is-empty"></image>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				// 页面数据初始化状态
				loadText: {
					loadmore: '轻轻上拉，加载更多',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				contact:[],
				more: false,
				page: 1, //页码
				limit: 10, //条数
				list: [], //
				problemClass: [{
						name: '教程',
						className: 'lit3'
					},
					{
						name: '解读',
						className: 'lit5'
					},
					{
						name: '规则',
						className: 'lit6'
					},

				],
			}
		},
		onLoad() {
			this.getContact()
		},
		onShow() {
			this.getList()
		},
		//下拉刷新
		onPullDownRefresh() {
			this.page = 1
			this.getList()
		},
		//上拉加载
		onReachBottom() {
			if (this.page == 1) {
				return
			}
			if (this.more) {

				this.getList()
			}
		},
		methods: {
			getContact() {
				this.$axios.request(this.$api.getParamsConfig, "GET", {
					config: "CONTACT"
				}).then((val) => {
					this.contact = val.data.paramValue.split(",")
				})
			},
			getList() {
				this.$axios.request(this.$api.getProblemRes, "GET", {
					page: this.page,
					limit: 15,
					orderField: 'id',
					order: 'desc'
				}).then((val) => {
					uni.stopPullDownRefresh();
					this.list = this.page == 1 ? val.data.list : this.list.concat(val.data.list)
					if (Math.ceil(val.data.total / this.limit) > this.page) {
						this.more = true;
						this.page++
					} else {
						this.more = false;
					}
				})
			},
			// 拨打的弹出层
			tel() {
				uni.makePhoneCall({
					phoneNumber: this.contact[0]
				});
			}

		}
	}
</script>
<style>
	/* 引入外部flex样式 */
	@import "../../style/contentFlex.css";

	.page {
		width: 100%;
		border-top: 1rpx solid #F3F4F8;
		background-color: #F3F4F8;
	}

	.header {
		width: 100%;
		height: 210rpx;
		background-color: #FFFFFF;
		margin: 16rpx 0;
	}

	.item {
		width: 172rpx;
		height: 140rpx;
	}

	.verticalLine {
		width: 2rpx;
		height: 120rpx;
		background: #F1F1F1;
		margin: 0 64rpx;
		opacity: 1;
	}

	.image {
		width: 60rpx;
		height: 60rpx;
	}

	.txt {
		font-size: 24rpx;
		font-family: "PingFang SC";
		font-weight: 300;
		line-height: 33rpx;
		color: #333333;
		opacity: 1;
		margin-top: 11rpx;
	}

	.footer {
		width: 100%;
		height: 100%;
		margin: 23rpx 0 23rpx;
		/* padding: 9rpx 32rpx 23rpx; */
		padding: 9rpx 20rpx 23rpx 32rpx;
		background-color: #fff;
		overflow-y: auto;
	}

	.footerTitle {
		width: 100%;
		height: 40rpx;
	}

	li:nth-child(1) {
		margin: 24rpx 0 50rpx;
	}

	.lit1 {
		font-size: 28rpx;
		font-family: "PingFang SC";
		font-weight: 600;
		color: #333333;
		opacity: 1;
		margin-right: 18rpx;
	}

	.lit2 {
		width: 555rpx;
		font-size: 28rpx;
		font-family: "PingFang SC";
		font-weight: 300;
		color: #666;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		opacity: 1;
	}

	.lit11 {
		font-size: 28rpx;
		font-family: "PingFang SC";
		font-weight: 300;
		color: #666;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		opacity: 1;
	}

	li {
		margin-top: 36rpx;
	}

	.lit3 {
		padding: 2rpx 8rpx;
		border: 1rpx solid #3975EA;
		margin-right: 14rpx;
		color: #3975EA;
	}

	.lit4 {
		padding: 2rpx 8rpx;
		border: 1rpx solid #3975EA;
		margin-right: 14rpx;
		color: #3975EA;
	}

	.lit5 {
		padding: 2rpx 8rpx;
		border: 1rpx solid #DEB68B;
		margin-right: 14rpx;
		color: #DEB68B;
	}

	.lit6 {
		padding: 2rpx 8rpx;
		border: 1rpx solid #FF5D58;
		margin-right: 14rpx;
		color: #FF5D58;
	}

	.lit7 {
		padding: 2rpx 8rpx;
		border: 1rpx solid #FF5D58;
		margin-right: 14rpx;
		color: #FF5D58;
	}

	.phoneCall,
	.callBack {
		width: 100%;
		height: 120rpx;
		background-color: #FFFFFF;
		border-radius: 20rpx;
	}

	.phoneCall {
		display: flex;
		justify-content: center;
		align-items: center;
		margin-bottom: 40rpx;
	}

	.callBack {
		font-size: 48rpx;
		font-family: "PingFang SC";
		font-weight: 300;
		line-height: 120rpx;
		text-align: center;
		color: #2E6ADF;
		opacity: 1
	}

	.phoneNub {
		font-size: 48rpx;
		font-family: "PingFang SC";
		font-weight: 300;
		line-height: 67rpx;
		color: #2E6ADF;
	}
</style>
